﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Net;

namespace RiotTweet
{
    public partial class LoginForm : Form
    {
        public LoginForm()
        {
            InitializeComponent();
        }

        public TwitterAccess Twitter { get; set; }

        private void LoginForm_Load(object sender, EventArgs e)
        {
            try
            {

                string url = Twitter.PostOauthRequestToken();
                UrlText.Text = url;
            }
            catch (WebException we)
            {
                MessageBox.Show(we.Message);
                Close();
                return;
            }
            AuthButton.Focus();
        }

        private void LoginButton_Click(object sender, EventArgs e)
        {
            PinText.Text = PinText.Text.Trim();
        }

        private void AuthButton_Click(object sender, EventArgs e)
        {
            Process.Start(UrlText.Text);
            LoginButton.Enabled = true;
        }
    }
}
